package practice1;

public class ReverseHello {

	public static void main(String[] args) {
		
			Thread thread = new thread();
		    thread.start();
		    thread.setName("Thread1");
		    
		
	}

}

class thread extends Thread {
	static int i = 0;
	public void run() {
		if(i < 50){
		    Thread thread = new thread();
		    thread.start();
		    thread.setName("Thread" + i);
		    try {
				thread.join();
			} catch (InterruptedException e) {
				e.printStackTrace();
			}
		}	
		System.out.println("Hello from " + Thread.currentThread().getName());
	}
	
	public thread() {
		i++;
	}
}